Using Ektron’s Search APIs

Ektron Provides two separate APIs for search. One is based on the “Web Search” architecture. The other is based on Ektron’s previous “Search’ architecture.

Using the Web Search API

Ektron CMS400.NET provides an API that lets you create a programmatic Web Search.

To see an example of the search API, go to the Developer Starter Site’s developer page (http://[your Web server]/cms400Developer/Developer/default.aspx) and click Search > Search API. In this section there are several examples of using the Web Search API for programmatic searches.

Note that below each example on the page is run this example. Click this link to run the search and view the results.

Using the Search API

Warning! This Search API is deprecated as of the 7.0 Release. For optimal performance, Ektron recommends using Ektron’s Web Search API. See Using the Web Search API.

 

Note: The Programmatic Search API does not support recursive searches. However, using code behind you can use the Search server control to programmatically search recursively. See Also: Web Search Server Control

Ektron CMS400.NET provides an API that lets you create a programmatic search on users and content. For example, you could use it to find all membership users whose zip code is 03031.

Guidelines for Creating a Search

Here are guidelines to follow when creating a search.

1. A search consists of one or more conditions. Each condition consists of an operator (and, OR, Like), a value, and the field whose value you are setting. See illustration below.

Dim isMemberShip As UserSearchCondition = New UserSearchCondition ’’’Condition

isMemberShip.setType = SearchType.Equal ’’’Operater

isMemberShip.setValue = 1 ’’’Value. The value can be integer,string,date and boolean should be match with db type

isMemberShip.setVariable = Users.membership_user ’’’Field

Dim isInEktron As UserSearchCondition = New UserSearchCondition ’’’Condition

isInEktron.setType = SearchType.Equal ’’’Operater

isInEktron.setValue = "03031" ’’’Value. The value can be integer,string,date and boolean should be match with dynamic_data_tbl labels type

isInEktron.setVariable = "customproperties.zip" ’’’Condition

Warning! If the field is a date, you can only use the following operators: EQUAL, NOT EQUAL, GREATERTHAN or LESSTHAN.

2. After all conditions are declared, declare the logical relationship between them. In other words, must the search criteria satisfy all or any conditions?

In the sample code below, the search only returns users that satisfy both declared conditions. This is indicated by the AND operator.

Dim condition As UserSearchCondition = New UserSearchCondition

condition.setType = SearchType.AND

condition.AddCondition(isInEktron)

condition.AddCondition(isMemberShip)

3. Execute the search.

Dim search As New SearchManager

Dim result As UserData() = search.Execute(condition)

search = Nothing

Previous TopicNext Topic|